        TITL DAI FIRMWARE 0EE09-0EFFF  V1.0  Rev.1
        ORG   :EE09
*
*
*
**********************************
* LIST EXPRESSION AFTER 'IF' (1) *
**********************************
*
* Lists '<expr> THEN <expr>'.
*
SCN21   CALL  :EFFC     List <expr>; print space
        CALL  :CE78     Print 'THEN'
MPT17   DBL   :EE15
        INX   B
        JMP   :ECCC     List statement
*
* DATA :
*
L0E350  DATA  :04
        DATA  :54       T
        DATA  :48       H
        DATA  :45       E
        DATA  :4E       N
*
**********************************
* LIST EXPRESSION AFTER 'IF' (2) *
**********************************
*
* Lists '<expr> GOTO <linenr>'.
*
SCN22   CALL  :EFFC     List <expr>; print space
        CALL  :CE78     Print 'GOTO'
        DBL   :CBF9
        JMP   :EFAE     List linenr
*
**********************************
* LIST EXPRESSION AFTER 'IF' (3) *
**********************************
*
* Lists '<expr> THEN <linenr>'.
*
SC22A   CALL  :EFFC     List <expr>; print space
        CALL  :CE78     Print 'THEN'
        DBL   :EE15
        JMP   :EFAE     List linenr
*
*******************************
* LIST EXPRESSION AFTER 'FOR' *
*******************************
*
* Lists '<LET statement> TO <expr> (STEP <expr>)'.
*
SCN23   CALL  :EDFF     List expr of LET statement
        CALL  :CE6B     Print space
        CALL  :CE78     Print 'TO'
        DBL   :EE4C
        CALL  :EEA2     List <expr>
        LDAX  B         Get next byte
        INX   B
        CPI   :FF       Terminator?
        RZ              Then abort
        DCX   B         Else:
        CALL  :CE75     Print 'STEP'
        DBL   :CD3D
        JMP   :EEA2     List <expr>
*
* DATA:
*
RLA20   DATA  :02
        DATA  :54       T
        DATA  :4F       O
*
********************************
* LIST EXPRESSION AFTER 'NEXT' *
********************************
*
SCN24   JMP   :EEFC     List var.ref.
*
**********************************
* LIST EXPRESSIONS AFTER 'PRINT' *
**********************************
*
SCN25   LDAX  B         Get nr of expr
        INX   B
        MOV   D,A       into D
S2510   DCR   D
        RM              Abort if ready
        INX   B
        CALL  :EEA2     List <expr>
        LDAX  B         Get next byte
        INX   B
        CPI   :FF       Terminator?
        RZ              Then abort
        CALL  :DD60     Else: print this byte
        JMP   :EE55     List next expr
*
**********************************
* LIST EXPRESSION AFTER 'ON' (1) *
**********************************
*
* Lists '<expr> GOTO <linenrs>'.
*
SCN26   CALL  :EFFC     List <expr>; print space
        CALL  :CE78     Print 'GOTO'
        DBL   :CBF9
        JMP   :EE79     List linenrs
*
**********************************
* LIST EXPRESSION AFTER 'ON' (2) *
**********************************
*
* Lists '<expr> GOSUB <linenrs>'.
*
SCN27   CALL  :EFFC     List <expr>; print space
        CALL  :CE78     Print 'GOSUB'
        DBL   :CC01
S2710   LDAX  B         Get nr of linenrs
        INX   B
        MOV   D,A       into D
S2720   CALL  :EFAE     List linenr
        DCR   D
        RZ              Abort if ready
        CALL  :CE70     Print ','
        JMP   :EE7C     List next linenr
*
*********************************
* LIST EXPRESSION AFTER 'CALLM' *
*********************************
*
SCN28   CALL  :EEA2     List <expr>
        JMP   :ED6E     Print ','; List next expr
*
*********************
* SET I/O DIRECTION *
*********************
*
* Part of RESET (C719). Only used for A = 0.
* Depending on A, the input switch #0296 and
* the output switch #0131 are set.
* Default DINC is RS232.
*
*            INSW:      OTSW:
*       A=0: keyboard   screen/RS232
*       A=1: DINC       screen
*       A=2: DINC       editbuffer
*       A=3: DINC       DOUTC
*
MPT02   STA   :0296     Select keyb or DINC
        STA   :0131     Select screen/RS232/edit/
 REM DOUTC
        RET
*
***************
* SET VOLUMES *
***************
*
* Part of RUN TALK (CD64).
*
* Entry: A: Parameter code.
*        HL: Pointer to volume byte.
*
RTK40   PUSH  H         Save pntr to volume
        MOV   L,M       Volume in L
        MVI   H,:0F
        RAR             Check parameter code
        JNC   :E67C     Jump if channel 0/2
*
* If channel 1/N:
*
        DAD   H
        DAD   H
        DAD   H
        JMP   :E67B     Continu
*
**********************
* LIST AN EXPRESSION *
**********************
*
* Entry: BC:   Points to expression in program.
*        (BC): 1.... Expr starts with operator.
*              01... Variable reference.
*              001.. Function call.
*              Else  Constant.
* Exit:  BC points after expression.
*        DE preserved, AFHL corrupted.
*
SCEXP   PUSH  D
        LDAX  B         Get opcode
        ORA   A
        JP    :EEDF     If no starting operator
 REM
* If starting with operator:
 REM
        INX   B
        ANI   :1F       Only 5 bits of opcode
        CPI   :1A       '(' ?
        PUSH  PSW       Save opcode
        CC    :EEA2     List expr if binary
 REM operation
        LXI   H,:CF86   Addr table opcode strings
L0E300  MOV   D,H       ) in DE
        MOV   E,L       )
        CALL  :DE39     HL points after table
        POP   PSW       Get opcode
        PUSH  PSW
        XRA   M         Comp it with table
        INX   H
        ANI   :1F
        JNZ   :EEB4     Check next opcode if not
 REM found
        XCHG            If found: addr string in HL
        INX   H
        MOV   A,M       Get 1st char
        DCX   H         Pnts to length
        CALL  :DE02     Check if upper case char
        PUSH  PSW
        CC    :CE6B     Print space if 1st char is
 REM a letter
        CALL  :DB32     Print string from table
        POP   PSW
        CC    :CE6B     Print space if 1st char was
 REM a letter
        CALL  :EEA2     List remaining operand
        POP   PSW       Get orig. opcode
        CPI   :1A       Was it '(' ?
        CZ    :EF55     Then print ')'
        POP   D
        RET
 REM
* Not starting with operator:
 REM
L0E301  RLC
        RLC
        JC    :EEF2     Jump if var.ref
        RLC
        JC    :EEED     Jump if function call
 REM
* If constant:
 REM
        CALL  :EF84     List constant
        POP   D
        RET
 REM
* If function call:
 REM
L0E302  CALL  :EF5A     List function reference
        POP   D
        RET
 REM
* If variable reference:
 REM
L0E303  CALL  :EEFC     List a var.reference
 REM (array with arguments)
        POP   D
        RET
*
*****************************
* LIST A VARIABLE REFERENCE *
*****************************
*
* SCARN:  Entry for arrays without arguments (name
*         only).
* L0E305: Entry for arrays with arguments.
*
* Entry: BC points to variable reference in program.
*
SCARN   MVI   D,:BF     Set mask 'no arg'
        JMP   :EEFE
*
L0E305  MVI   D,:FF     Set mask 'with arg'
L0E306  PUSH  D         Save mask
        LDAX  B         Get byte
        INX   B
        ANI   :3F       Skip bit 6,7
        MOV   D,A       Rest in D
        LDAX  B         Get next byte
        INX   B
        MOV   E,A       in E (Now DE is offset
 REM of start of symtab)
        LHLD  :02A1     Get start symtab
        DAD   D         Add offset from start
        POP   D         Get mask
        PUSH  H         Save var.addr in symtab
        CALL  :CA95     Find name in symtab
        MOV   A,M       Get T/L byte
        ANA   D         AND with mask
        PUSH  PSW
        INX   H
        ANI   :0F       Get length
        MOV   E,M       Get 1st byte of name in E
        CALL  :DB44     List name; addr in HL,
 REM length in A
        MVI   D,:00
        LXI   H,:0234   Startaddr for IMPTAB
        DAD   D         Addr var.type in IMPTAB
        POP   PSW       Get mask
        PUSH  PSW
        ANI   :30       Bits 4,5 only
        CMP   M         Comp with IMPTAB
        JZ    :EF3C     Jump if identical
        CPI   :00       FPT ?
        MVI   D,:21     Then D: '!'
        JZ    :EF38
        CPI   :10       INT ?
        MVI   D,:25     Then D: '%'
        JZ    :EF38
        MVI   D,:24     Else: D: '$'
L0E307  MOV   A,D
        CALL  :DD60     Print type sign
L0E308  POP   PSW       Get mask
        ANI   :40       Bit 6 only
        POP   H         Get addr of string
        RZ
 REM
* Bit 6=1 (array with arguments):
 REM
        LDAX  B         Get nr of expressions
        INX   B
        MOV   D,A       in D
        CALL  :EFF5     Print '('
        DATA  :28
L0E309  INX   B
        PUSH  D
        CALL  :EEA2     List expression
        POP   D
        DCR   D         Ready ?
        CNZ   :CE70     If not: print ','
        JNZ   :EF48     and list next expr
L0E310  CALL  :EFF5     If ready: Print ')'
        DATA  :29
        RET
*
*****************************
* LIST A FUNCTION REFERENCE *
*****************************
*
* Finds functionname in table with startaddress
* #CFE6 and prints it. Eventual arguments are
* printed between brackets.
*
* Entry: BC points to function code (#20).
* Exit:  BC updated, AFEHL preserved, D=0.
*
SFUN    INX   B
        LDAX  B
        INX   B
        MOV   D,A
        LXI   H,:CFE6   Startaddr function table
L0E312  DCR   D
        JM    :EF6B     If found
        CALL  :CAAE     Calc addr next string in tab
        JMP   :EF61     Test next function name
L0E313  CALL  :DB32     List function name
        MOV   A,M       Get byte after string
        ANI   :0F       Only nr of following args
        MOV   D,A       in D
        RZ              Abort if no arguments
        CALL  :EFF5     Print '('
        DATA  :28
L0E314  CALL  :EEA2     List expression
        DCR   D         Decr nr of arg
        CNZ   :CE70     If <>0, print ','
        JNZ   :EF77     and list next expr
        JMP   :EF55     If ready: print ')'
*
*******************
* LIST A CONSTANT *
*******************
*
* The constant is decoded to ASCII, prettied and
* printed.
*
* Codes:   #10: FPT       #18: Quoted string
*          #14: INT       #19: Unquoted string
*          #15: HEX
*
* Entry: BC: Points to constant in program.
* Exit:  BC updated, DE preserved, AF corrupted.
*        HL: points after end of printed string.
*
SCON    LDAX  B         Get type of constant
        INX   B
        MOV   H,B       ) Addr constant in HL
        MOV   L,C       )
 REM
* If string:
 REM
        CPI   :18       Quoted string ?
        JZ    :EFE1     Then list it
        CPI   :19       Unquoted string ?
        JZ    :EFED     Then list it
 REM
* If number:
 REM
        RST   4         Copy constant value to MACC
        DATA  :0C
        CPI   :10       FPT ?
        JZ    :EFA8     Then list FPT value
        CPI   :14       INT ?
        PUSH  PSW
        CZ    :EFBD     List INT value
        POP   PSW
        CNZ   :EFDA     Else: list HEX value
SC010   INX   B
        INX   B
        INX   B
        INX   B         BC points after constant
        RET
SC020   CALL  :EFD4     List FPT value
        JMP   :EFA3
*
*********************
* LIST A LINENUMBER *
*********************
*
* Entry: BC: Points to linenumber.
* Exit:  BC updated, DE preserved, AFHL corrupted.
*
L0E318  LDAX  B         Get hibyte linenr
        INX   B
        MOV   H,A       in H
        LDAX  B         Get lobyte linenr
        INX   B
        MOV   L,A       in L
SLN10   CALL  :EB46     Linenr into MACC
        MOV   A,H
        ORA   L         Linenr <>0 ?
        CNZ   :EFBD     Then list linenr
        RET
*
*************************************
* LIST A INT VALUE OF MACC CONTENTS *
*************************************
*
* The value is the contents of the MACC, prepared
* for output, and moved into the outputbuffer
* DECBUF (#00E3). A Leading space is omitted.
*
* Exit: BCDE preserved. A corrupted.
*       HL: Points after string in DECBUF.
*
SCINT   CALL  :DB5F     Convert MACC for INT
 REM output into DECBUF
SSSPC   LHLD  :C033     Get addr DECBUF
        PUSH  D
        MOV   D,M       String length in D
        INX   H
        MOV   A,M       1st char in A
        CPI   :20       Space ?
        JNZ   :EFCE     Jump if no leading space
        INX   H         ) Omit leading space
        DCR   D         )
SSS10   MOV   A,D       Get nr of char in A
        POP   D
        CALL  :DB44     Print contents DECBUF
        RET
*
***********************************
* LIST FPT VALUE OF CONTENTS MACC *
***********************************
*
* Exit: BCDE preserved. AF corrupted.
*       HL points after string in DECBUF.
*
SCFPT   CALL  :CE9B     Convert MACC for FPT output
        JMP   :EFC0     List its contents
*
***********************************
* LIST HEX VALUE OF CONTENTS MACC *
***********************************
*
* Exit: BCDE preserved. AF corrupted.
*       HL points after string in DECBUF.
*
SCHEX   CALL  :EFF5     Print '#'
        DATA  :23
        JMP   :DB4A     List in hex
*
************************
* LIST A QUOTED STRING *
************************
*
* Entry: BC: Points to string.
* Exit:  BC and HL point after string.
*        AF corrupted. DE preserved.
*
SQTS    CALL  :EFF5     Print "
        DATA  :22
        CALL  :EFED     List string
        CALL  :EFF5     Print "
        DATA  :22
        RET
*
************************
* LIST UNQUOTED STRING *
************************
*
* Entry: BC points to string.
* Exit:  BC and HL point after string.
*        AFDE preserved.
*
SUQTS   MOV   H,B       ) Stringaddr in HL
        MOV   L,C       )
        CALL  :DB32     List string
        MOV   B,H       )
        MOV   C,L       ) Addr after string in BC
        RET
*
******************
* LIST CHARACTER *
******************
*
* Entry: On stack: The address of the character to
*                  be printed.
* Exit:  BCDEHL preserved. F corrupted.
*        A: Character printed.
*
SCHRI   XTHL            Get addr from stack
        MOV   A,M       Get char
        INX   H         HL pnts after char
        XTHL            Returnaddr on stack
        JMP   :DD60     List char.
*
********************************
* LIST EXPRESSION; PRINT SPACE *
********************************
*
SEXPS   JMP   :CE68     List expr, print space
*
        DATA  :3E
*
*
*
        END
